package com.chinasofti.list;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Demo03 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");

        Iterator<String> it = list.iterator();
        while(it.hasNext()){
            String s = it.next();
            System.out.println("s = " + s);
        }
        for (String str:list){
            System.out.println("str = " + str);
        }

    }
}
